<template>
  <div>
    <div id="container">

      <div id="header">
      </div>

    </div>
    <div id="container">
      <div id="content2">
        <table width="100%" height="41" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="15" height="18" align="left" valign="top">
              <div align="left"></div>
            </td>
            <td width="385" align="left" valign="bottom" class="12">&nbsp;</td>
          </tr>
          <tr>
            <td height="4" colspan="2" align="left" valign="bottom"></td>
          </tr>
          <tr>
            <td height="15" align="left" valign="top">&nbsp;</td>
            <td height="15" align="left" valign="top" class="12">
              <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="20">

                    <el-table :data="user" :row-class-name="tableRowClassName">
                      <el-table-column label="编号id" prop="categoryid"></el-table-column>
                      <el-table-column label="分类名称" prop="categoryname"></el-table-column>
                      <el-table-column label="开始申报时间" prop="rep_start_time"></el-table-column>
                      <el-table-column label="申报结束时间" prop="rep_stop_time"></el-table-column>
                      <el-table-column label="操作">
                        <template >
                          <el-row>
                            <el-button type="danger" @click="updateVisible = true">申报</el-button>
                          </el-row>
                        </template>
                      </el-table-column>
                    </el-table>

                    <!--展示-->

                    <el-dialog title="更新品牌" :visible.sync="updateVisible" width="30%">
                      <el-form ref="form" :model="update" label-width="80px">

                        <el-form-item label="项目名称">
                          <el-input v-model="update.projectname"></el-input>
                        </el-form-item>

                        <el-form-item label="申请单位">
                          <el-input v-model="update.unitname"></el-input>
                        </el-form-item>

                        <el-form-item label="申请人">
                          <el-input v-model="update.applicant"></el-input>
                        </el-form-item>

                        <el-form-item label="职称">
                          <el-input v-model="update.grade"></el-input>
                        </el-form-item>

                        <el-form-item label="学历">
                          <el-input v-model="update.education"></el-input>
                        </el-form-item>

                        <el-form-item label="填报时间">
                          <el-input v-model="update.fill_date"></el-input>
                        </el-form-item>

                        <el-form-item label="项目现状">
                          <el-input v-model="update.status"></el-input>
                        </el-form-item>

                        <el-form-item label="项目前景">
                          <el-input v-model="update.future"></el-input>
                        </el-form-item>

                        <el-form-item label="重难点分析">
                          <el-input v-model="update.analysis"></el-input>
                        </el-form-item>
                        <el-form-item label="研究方法">
                          <el-input v-model="update.way"></el-input>
                        </el-form-item>
                        <el-form-item label="预计研究成果">
                          <el-input v-model="update.result"></el-input>
                        </el-form-item>
                        <el-form-item label="申请资金">
                          <el-input v-model="update.capital"></el-input>
                        </el-form-item>
                        <el-form-item>
                          <el-button type="primary" @click="updateProject()">提交</el-button>
                          <el-button type="primary" @click="reset()">重置</el-button>
                        </el-form-item>
                      </el-form>
                    </el-dialog>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </div>
    </div>
    <br />
    <div class="table_wz"></div>





  </div>
</template>

<script>

import axios from '../../utils/Myaxios'
const options = {
  data() {
    return {
      updateVisible: false,
      update: {
        projectname: '',
        unitname: '',
        applicant: '',
        grade: '',
        education: '',
        fill_date: '',
        status: '',
        future: '',
        analysis: '',
        way: '',
        result: '',
        capital: '',
        categoryid: ''
      },
      user: []
    }
  },
  mounted() {
    this.get();
  },
  methods: {
    async get() {
      const _axios = axios.create({
        baseURL: 'http://localhost:8080',
        withCredentials: true
      })
      const resp = await _axios.get('/projectcategorys/selectFour')
      console.log(resp)
      this.update.categoryid = resp.data.data.categoryid
      this.user = resp.data.data
    },
    // 查询
    // async project(row) {
    //   this.updateVisible = true;
    //   let rowId = row.id;
    //   const _axios = axios.create({
    //     baseURL: 'http://localhost:8080',
    //     withCredentials: true
    //   })
    //   const resp = await _axios.get('/projectcategorys/selectById', {
    //     params: {
    //       categoryid: rowId
    //     }
    //   })
    //   this.update = resp.data.data
    // },
    reset(){
      this.update = []
    },
    async updateProject(){
      const _axios = axios.create({
        baseURL: 'http://localhost:8080',
        withCredentials: true
      })
      await _axios.post('/projects',{},{
        params:{
          update: this.update
        }
      })

    }
  }

}

export default options
</script>

<style>

</style>